package Instance;

import activity.LoginActivity;
import android.content.Context;
import android.content.Intent;
import utils.SetUtils;

public class LoginState {
	public  LoginState(){
		
	}
	
	private static LoginState instance = new LoginState();

	public static LoginState getInstance() {
		return instance;
	}
	
	public boolean isLogin(Context context) {
		return SetUtils.islogined(context);
	}

	public void startActivity(Context context, Class clazz) {
		if (LoginState.getInstance().isLogin(context)) {
			context.startActivity(new Intent(context, clazz));
		} else {
			context.startActivity(new Intent(context, LoginActivity.class));
		}
	}
	
	public void startUserActivity(Context context, Class clazz) {
		if (LoginState.getInstance().isLogin(context)) {
			Intent intent=new Intent(context,clazz);
			intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			context.startActivity(intent);
		} 
	}

	public void login() {

	}

	public void logout() {
	}
	
}
